package prototypeadv;

import java.util.ArrayList;

public class Thing implements Cloneable {

	// 定义一个私有变量
	private ArrayList<String> arrayList = new ArrayList<String>();

	@Override
	public Thing clone() {
		Thing thing = null;
		try {
			//浅拷贝
			thing = (Thing) super.clone();
			//深拷贝
			thing.arrayList = (ArrayList<String>) this.arrayList.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return thing;
	}
}